package lc69;

public class Lc69 {

    public int peakIndexInMountainArray(int[] arr) {
        int l = 0;
        int r = arr.length - 1;

        while(l <= r){
            int mid = r / 2;
            if(arr[l] < arr[mid] && arr[r] > arr[mid]){
                l = mid;
            }
            if(arr[l] > arr[mid] && arr[r] < arr[mid]){
                r = mid;
            }
            if(arr[l] < arr[r]){
                l++;
            }else{
                r--;
            }
        }
        return r;
    }

    public static void main(String[] args) {
        Lc69 lc29 = new Lc69();
        lc29.peakIndexInMountainArray(new int[]{0, 1, 0});

    }

}
